<template>
  <div>
    <el-button type="primary" :loading="isloading" @click="exportCsvFun"
      >下载文件
    </el-button>
    <el-progress type="dashboard" :percentage="csvProcess" />
  </div>
</template>

<script setup>
import { exportCsv } from './export'
import { ref } from 'vue'
const csvProcess = ref(0)
const isloading = ref(false)

const exportCsvFun = async () => {
  try {
    isloading.value = true
    await exportCsv(10000 * 120, 2000, (process) => {
      csvProcess.value = process
    })
  } catch (error) {
    alert(error)
  } finally {
    isloading.value = false
  }
}
</script>

<style lang="scss" scoped>
</style>